/*
 * board.h
 *
 *  Created on: Sep 13, 2013
 *      Author: Ken Arok
 */

#include "config_board.h"

#if BOARD_2_1_USED

#ifndef BOARD_H_
#define BOARD_H_

#include "compiler.h"


/* CPU Frequency. */
#define F_CPU		14745600UL
//#define F_CPU		4000000UL

/*
 PORT A
---------------------------------------------------------------------------------------------------------
|	PA7		|	PA6		|	PA5		|	PA4		|		PA3		|	PA2		|	PA1		|		PA0		|
---------------------------------------------------------------------------------------------------------
|	GPIO	|	GPIO	| 	GPIO	|	GPIO	|	RS485_SEL	|	GPIO	|	GPIO	|	RS232_SEL	|
---------------------------------------------------------------------------------------------------------
*/

#define GPIO_PINA7			PA7
#define GPIO_PINA6			PA6
#define GPIO_PINA5			PA5
#define GPIO_PINA4			PA4
#define GPIO_RS485_SEL		PA3
#define GPIO_PINA2			PA2
#define GPIO_PINA1			PA1
#define GPIO_RS232_SEL		PA0

/*
 PORT B
-----------------------------------------------------------------------------------------------------
|	PB7		|	PB6		|	PB5		|	PB4		|	PB3		|	PB2		|	PB1			|	PB0		|
-----------------------------------------------------------------------------------------------------
|	SCK		|	MISO	| 	MOSI	|	SS		|	TX1		|	RX1		|	RS485_RW	|	GPIO	|
-----------------------------------------------------------------------------------------------------
*/
#define GPIO_SPI_SCK		PB7
#define GPIO_SPI_MISO		PB6
#define GPIO_SPI_MOSI		PB5
#define GPIO_SPI_SS			PB4
#define GPIO_UART1_TX		PB3
#define GPIO_UART1_RX		PB2
#define GPIO_RS485_RW		PB1
#define GPIO_PINB0			PB0

/*
 PORTC
-------------------------------------------------------------------------------------------------
|	PC7		|	PC6		|	PC5		|	PC4		|	PC3		|	PC2		|	PC1		|	PC0		|
-------------------------------------------------------------------------------------------------
|	GPIO	|	GPIO	| 	GPIO	|	GPIO	|	GPIO	|	GPIO	|	GPIO	|	GPIO	|
-------------------------------------------------------------------------------------------------
*/
#define GPIO_PINC7			PC7
#define GPIO_PINC6			PC6
#define GPIO_PINC5			PC5
#define GPIO_PINC4			PC4
#define GPIO_PINC3			PC3
#define GPIO_PINC2			PC2
#define GPIO_PINC1			PC1
#define GPIO_PINC0			PC0

/*
 PORTD
-----------------------------------------------------------------------------------------------------
|	PD7		|	PD6		|	PD5		|	PD4		|	PD3		|	PD2			|	PD1		|	PD0		|
-----------------------------------------------------------------------------------------------------
|	GPIO	|	GPIO	| 	GPIO	|	GPIO	|	GPIO	|	MEGA128_CS	|	TX0		|	RX0		|
-----------------------------------------------------------------------------------------------------
*/
#define GPIO_PIND7			PD7
#define GPIO_PIND6			PD6
#define GPIO_PIND5			PD5
#define GPIO_PIND4			PD4
#define GPIO_PIND3			PD3
#define GPIO_MEGA128_CS		PD2
#define GPIO_UART0_TX		PD1
#define GPIO_UART0_RX		PD0

/*
 PORTE
-----------------------------------------------------------------------------
|	PE7	|	PE6	|	PE5	|	PE4	|	PE3	|	PE2		|	PE1		|	PE0		|
-----------------------------------------------------------------------------
|	-	|	-	| 	-	|	-	|	-	|	LED_HB	|	Buzzer	|	GPIO	|
-----------------------------------------------------------------------------
*/
#define GPIO_LED_HB			PE2
#define GPIO_BUZZER			PE1
#define GPIO_PINE0			PE0


/*! \brief This function initializes the board target resources.
 */
extern void board_init(void);


#endif /* BOARD_H_ */

#endif /* BOARD_2_1_USED. */
